package com.lanchetech.user.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lanchetech.bean.request.UserAmtLogReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.util.PageHelpUtil;
import com.lanchetech.bean.vo.UserAmtLogVo;
import com.lanchetech.dao.UserAmtLogMapper;
import com.lanchetech.entity.UserAmtLog;
import com.lanchetech.user.service.UserAmtLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserAmtLogServiceImpl implements UserAmtLogService {

    @Autowired
    private UserAmtLogMapper userAmtLogMapper;

    @Override
    public ResultData<BasePageResp<UserAmtLogVo>> getUserAmtLog(UserAmtLogReq userAmtLogReq) {
        Page page = PageHelper.startPage(userAmtLogReq.getPageNo(), userAmtLogReq.getPageSize());
        List<UserAmtLogVo> userAmtLogVoList = userAmtLogMapper.getByUserId(userAmtLogReq);
        return PageHelpUtil.buildPage(userAmtLogVoList, page);
    }
}
